/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.hva.bluepumpkin.util;

/**
 *
 * @author USER
 */
public class Page {

    public static int[] getPageLink(int total, int numRow) {
        int totalPage = total / numRow;
        int surplus = total % numRow;
        int[] page;
        if (surplus > 0) {
            page = new int[totalPage + 1];
        } else {
            page = new int[totalPage];
        }

        int i = 0;
        for (; i < totalPage; i++) {
            page[i] = i + 1;
        }

        if (surplus > 0) {
            page[i] = i + 1;

        }
        return page;
    }
}
